package com.dzm.xgb.core.strategy.impl;

import com.dzm.xgb.core.enums.ReturnMethodEnum;
import com.dzm.xgb.core.factory.ReturnHandlerFactory;
import com.dzm.xgb.core.strategy.ReturnHandler;
import com.dzm.xgb.core.utils.Amount2Helper;
import com.dzm.xgb.core.utils.Amount4Helper;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 作者：Dzm
 * 时间：2024-09-27-11:48
 * 功能：
 */
@Component
public class TwoReturnHandler implements ReturnHandler {

    @Override
    public BigDecimal getInterestCount(BigDecimal invest, BigDecimal yearRate, int totalMonth) {
        return Amount2Helper.getInterestCount(invest, yearRate, totalMonth);
    }

    @Override
    public Map<Integer, BigDecimal> getPerMonthInterest(BigDecimal amount, BigDecimal yearRate, int totalmonth) {
        return Amount2Helper.getPerMonthInterest(amount, yearRate, totalmonth);
    }

    @Override
    public Map<Integer, BigDecimal> getPerMonthPrincipal(BigDecimal amount, BigDecimal yearRate, int totalmonth) {
        return Amount2Helper.getPerMonthPrincipal(amount, yearRate, totalmonth);
    }

    @Override
    public Map<Integer, BigDecimal> getPerMonthPrincipalInterest(BigDecimal invest, BigDecimal yearRate, int totalMonth) {
        return Amount2Helper.getPerMonthPrincipalInterest(invest, yearRate, totalMonth);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        ReturnHandlerFactory.registerReturnHandler(ReturnMethodEnum.TWO.getMethod().toString(), this);
    }
}
